﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FlashPay.Service.Interface
{
    using FlashPay.EF.Models;
    using FlashPay.Entity;
    using FlashPay.Entity.Parameter;
    using FlashPay.Entity.Request.User;
    using FlashPay.Entity.Response.Role;
    using FlashPay.Entity.Response.User;

    /// <summary>
    /// 用户业务接口
    /// </summary>
    public interface UserInfoService
    {
        /// <summary>
        /// 根据编号获取用户
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns>Company</returns>
        JResult<UserInfoResponse> Get(int id);

        /// <summary>
        /// 根据编号获取公司
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns>Company</returns>
        JResult<UserInfoResponse> GetById(TicketResponse ticketResponse, int? id);

        /// <summary>
        /// 根据编号获取用户(SQL)
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns>UserInfo</returns>
        UserInfo GetUserInfo(int id);

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="request"></param>
        JResult<LoginResponse> Login(LoginRequest request);

        JResult<UserPermissionResponse> GetUserPermission(UserPermissionReqeust request);

        /// <summary>
        /// 更新密码
        /// </summary>
        /// <returns></returns>
        JResult UpdatePassWord(UpdatePassWordRequest request);

        /// <summary>
        /// 事务测试
        /// </summary>
        /// <returns></returns>

        JResult TranTest();

        /// <summary>
        /// 获取用户下拉列表
        /// </summary>
        /// <returns>List<UserInfo></returns>
        List<UserInfo> GetList(UserInfoQuery query);

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns>PagedList<UserInfo></returns>
        PagedList<UserInfo> GetPager(UserInfoQuery query);

        //根据id集合查出用户信息
        PagedList<UserInfo> GetUserInfoByIds(List<int> query, int pageIndex, int pageSize);

        //更新用户信息
        bool UpdateUserInfo(UserInfo model);

        /// <summary>
        /// 保存、编辑用户
        /// </summary>
        /// <param name="userinfo"></param>
        /// <returns></returns>
        JResult SaveOrEditUserInfo(SaveOrEditUserInfoRequest userinfo, List<int> roleIds);

        //更新用户状态
        JResult UpdateStatus(UserInfoQuery query);

        //更新谷歌验证状态
        JResult ChangeLoggedIn(UserInfo query);

        //删除用户
        JResult Delete(UserInfoQuery query);

        //登录名是否已存在
        bool CheckLoginName(UserInfoQuery query);

        //原密码是否正确
        bool CheckOldPwd(UserInfoQuery query);

        //保存用户信息
        JResult SaveUserInfo(UserInfoQuery query);

        /// <summary>
        /// 通过条件获取用户信息
        /// </summary>
        JResult<List<UserInfo>> SearchUserInfo(string SearchValue, int CompanyId);

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns>PagedList<UserInfo></returns>
        PagedList<UsersResponse> GetUsersPager(UsersQuery query);

        /// <summary>
        /// 获取公司角色
        /// </summary>
        /// <param name="companyId"></param>
        JResult<List<RoleResponse>> GetRoleList(int companyId);
    }
}
